package spring.beanTest.LoopDependentFieldSingle;


import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext-beanTest.xml");
        //此时必须要获取Spring管理的实例，因为现在scope="prototype" 只有请求获取的时候才会实例化对象
        StudentA studentA = (StudentA) context.getBean("studentA");
        System.out.println(studentA.getStudentB());
        StudentB studentB = (StudentB) context.getBean("studentB");
        System.out.println(studentB.getStudentC());
        StudentC studentC = (StudentC) context.getBean("studentC");
        System.out.println(studentC.getStudentA());
//        for(String s: context.getBeanDefinitionNames())
//            System.out.println(s);
    }
}